package com.iris.live.services.data.repositories;

import com.iris.live.services.data.models.Lsh金融战败原因Model;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by sxy on 2016/7/11.
 */
public interface Lsh金融战败原因Repository extends JpaRepository<Lsh金融战败原因Model, Integer>, JpaSpecificationExecutor<Lsh金融战败原因Model> {

    @Modifying
    @Query("update Lsh金融战败原因Model u set u.启用状态 = ?2 where u.金融战败原因编号 = ?1")
    int set启用状态By金融战败原因编号(int id, String status);

    @Query("select u from  Lsh金融战败原因Model u   where u.金融战败原因编号 = ?1 and  u.启用状态='启用' ")
    Lsh金融战败原因Model getstatusbysql(int id);

    @Query("select u from  Lsh金融战败原因Model u   where u.战败原因 = ?1 and  u.启用状态='启用' ")
    List<Lsh金融战败原因Model> getstatusbyreasonAndsql(String id);

    @Query("select u from Lsh金融战败原因Model u where u.启用状态='启用' and (u.许可=?1 or u.许可='LSH')")
    List<Lsh金融战败原因Model> findListByPermit(String permit);


}
